<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实验1</title>
</head>
<body>
    <script>
        function getSum(num1, num2){
            var sum = num1 + num2;
            console.log(num1+"+"+num2+"="+(num1+num2))
        }
        getSum(6,66);

        getProduct(2,4);
        var getProduct = function(num1, num2){
            console.log(num1+"*"+num2+"="+num1*num2);
        }
        
        var a = 100;
        function test(){
            console.log(a);
            a = 10;
            console.log(a);
        }
        test();
        console.log(a);

        var a = 10;
        fun1();
        function fun1(){
            var b = 20;
            console.log(a);
            console.log(b);
            var a = 30;
        }
        
        function fun2(a, b){
            console.log(arguments[0]);
            console.log(arguments[1]);
            console.log(arguments[2]);
        }
        fun2(1,2,3);

        var number
        var mynumber = new Array()
        mynumber[0] = 1
        mynumber[1] = 2
        mynumber[2] = 3

        for (number in mynumber)
        {
        document.write(mynumber[number] + "<br />")
        }

        "use strict";
        num = 100;

        try{
            function myFunction() {
            "use strict";
            y = 666;   // 报错 (y 未定义)
            }
            myFunction();
        }
        catch(err){
            document.write("严格模式下 y未定义");
        }   
    </script>
</body>
</html>